package com.gopay.common.domain.gsrt;
// Generated 2016-1-16 17:20:08 by Hibernate Tools 4.3.1.Final

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

/**
 * Entity: 分账明细表      放款和回款公用表
 */
@Entity
@Table(name = "GSRT_LOAN_DISBURS_RETURNED_SUB")
public class GsrtLoanDisbursReturnedSub implements java.io.Serializable {
	
    // 业务类别
    public enum Type {
    	LOANDISBURSEMENTS("01", "放款"), RETURNEDMONEY("02", "回款");

        private String code;
        private String name;

        private Type(String code, String name) {
            this.name = name;
            this.code = code;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getNameByCode(String code) {
            if (code == null) {
                return null;
            }
            for (Type flag : Type.values()) {
                if (flag.getCode().equals(code)) {
                    return flag.name;
                }
            }
            return null;
        }
    }
    
    // 账户类型
    public enum AccountType {
        PLATFORM("01", "平台账户"), RISKCAPITAL("02", "风险金账户"), GUARANTEE("03", "担保方账户");

        private String code;
        private String name;

        private AccountType(String code, String name) {
            this.name = name;
            this.code = code;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getNameByCode(String code) {
            if (code == null) {
                return null;
            }
            for (AccountType flag : AccountType.values()) {
                if (flag.getCode().equals(code)) {
                    return flag.name;
                }
            }
            return null;
        }
    }

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/** 
     * 分账明细ID
     */
    private Long id;

    /**
     * 放款_回款父子关系字段ID关联
     */
    private Long parentDsRnId;

    /** 
     * 商户订单号
     */
    private String merOrderId;

    /** 
     * 商户id
     */
    private String merCustId;

    /** 
     * 商户提交时间
     */
    private Date merTxnTm;

    /** 
     * 国付宝交易时间
     */
    private Date gopayTxnTm;

    /** 
     * 国付宝订单号
     */
    private String gopayOrderId;

    /** 
     * 付款方客户ID
     */
    private String payCustId;

    /** 
     * 主收款方客户ID
     */
    private String mainRecvCustId;

    /** 
     * 付款方账户
     */
    private String payAcct;

    /** 
     * 主收款方账户
     */
    private String mainRecvAcct;

    /** 
     * 交易状态 成功：20000    ，进行中 ：30000  ，失败：20002
     */
    private int txnStaCd;

    /** 
     * 分账金额
     */
    private BigDecimal merTxnAmt;

    /** 
     * 创建时间
     */
    private Date createdTs;

    /** 
     * 账户类型---------01平台账户; 02平台风险金账户;03 担保方账户
     */
    private String accountType;

    /** 
     * 业务类别  放款01 ; 回款02
     */
    private String type;

    /** 
     * 担保方协议号
     */
    private String suretyConstracterId;

    /** 
     * 交易原因
     */
    private String commentRk;

    /** 
     * 记录最后修改时间
     */
    private Date lastUpdTs;

    /** 
     * 预留字段3
     */
    private String remark3;

    /** 
     * 预留字段2
     */
    private String remark2;

    /** 
     * 备注
     */
    private String remark;

    /** 
     * 乐观锁版本号
     */
    private Long version;
    
    /** 
	 * 交易处理完成时间
	 */
    private Date tranFinishTime;
    
    public GsrtLoanDisbursReturnedSub() {
    }


    @Id
    @SequenceGenerator(name = "GsrtLoanDisbursReturnedSubSequence", sequenceName = "GSRT_LOAN_DISBURS_RETURNED_SEQ")
    @GeneratedValue(generator = "GsrtLoanDisbursReturnedSubSequence", strategy = GenerationType.SEQUENCE)
    @Column(name = "ID", unique = true, nullable = false, precision = 22, scale = 0)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "PARENT_DS_RN_ID")
    public Long getParentDsRnId() {
        return this.parentDsRnId;
    }

    public void setParentDsRnId(Long parentDsRnId) {
        this.parentDsRnId = parentDsRnId;
    }

    @Column(name = "MER_ORDER_ID", nullable = false, length = 30)
    public String getMerOrderId() {
        return this.merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    @Column(name = "MER_CUST_ID", nullable = false, length = 10)
    public String getMerCustId() {
        return this.merCustId;
    }

    public void setMerCustId(String merCustId) {
        this.merCustId = merCustId;
    }

    @Column(name = "MER_TXN_TM", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getMerTxnTm() {
        return this.merTxnTm;
    }

    public void setMerTxnTm(Date merTxnTm) {
        this.merTxnTm = merTxnTm;
    }

    @Column(name = "GOPAY_TXN_TM", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getGopayTxnTm() {
        return this.gopayTxnTm;
    }

    public void setGopayTxnTm(Date gopayTxnTm) {
        this.gopayTxnTm = gopayTxnTm;
    }

    @Column(name = "GOPAY_ORDER_ID", nullable = false, length = 30)
    public String getGopayOrderId() {
        return this.gopayOrderId;
    }

    public void setGopayOrderId(String gopayOrderId) {
        this.gopayOrderId = gopayOrderId;
    }

    @Column(name = "PAY_CUST_ID", length = 10)
    public String getPayCustId() {
        return this.payCustId;
    }

    public void setPayCustId(String payCustId) {
        this.payCustId = payCustId;
    }

    @Column(name = "MAIN_RECV_CUST_ID", length = 10)
    public String getMainRecvCustId() {
        return this.mainRecvCustId;
    }

    public void setMainRecvCustId(String mainRecvCustId) {
        this.mainRecvCustId = mainRecvCustId;
    }

    @Column(name = "PAY_ACCT", length = 19)
    public String getPayAcct() {
        return this.payAcct;
    }

    public void setPayAcct(String payAcct) {
        this.payAcct = payAcct;
    }

    @Column(name = "MAIN_RECV_ACCT", length = 19)
    public String getMainRecvAcct() {
        return this.mainRecvAcct;
    }

    public void setMainRecvAcct(String mainRecvAcct) {
        this.mainRecvAcct = mainRecvAcct;
    }

    @Column(name = "TXN_STA_CD", nullable = false, length = 5)
    public int getTxnStaCd() {
        return this.txnStaCd;
    }

    public void setTxnStaCd(int txnStaCd) {
        this.txnStaCd = txnStaCd;
    }

    @Column(name = "MER_TXN_AMT", nullable = false, precision = 20)
    public BigDecimal getMerTxnAmt() {
        return this.merTxnAmt;
    }

    public void setMerTxnAmt(BigDecimal merTxnAmt) {
        this.merTxnAmt = merTxnAmt;
    }

    @Column(name = "CREATED_TS", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getCreatedTs() {
        return this.createdTs;
    }

    public void setCreatedTs(Date createdTs) {
        this.createdTs = createdTs;
    }

    @Column(name = "ACCOUNT_TYPE", nullable = false, length = 4)
    public String getAccountType() {
        return this.accountType;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    @Column(name = "TYPE", nullable = false, length = 5)
    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Column(name = "SURETY_CONSTRACTER_ID", length = 30)
    public String getSuretyConstracterId() {
        return this.suretyConstracterId;
    }

    public void setSuretyConstracterId(String suretyConstracterId) {
        this.suretyConstracterId = suretyConstracterId;
    }

    @Column(name = "COMMENT_RK", length = 50)
    public String getCommentRk() {
        return this.commentRk;
    }

    public void setCommentRk(String commentRk) {
        this.commentRk = commentRk;
    }

    @Column(name = "LAST_UPD_TS")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getLastUpdTs() {
        return this.lastUpdTs;
    }

    public void setLastUpdTs(Date lastUpdTs) {
        this.lastUpdTs = lastUpdTs;
    }

    @Column(name = "REMARK3", length = 50)
    public String getRemark3() {
        return this.remark3;
    }

    public void setRemark3(String remark3) {
        this.remark3 = remark3;
    }

    @Column(name = "REMARK2", length = 50)
    public String getRemark2() {
        return this.remark2;
    }

    public void setRemark2(String remark2) {
        this.remark2 = remark2;
    }

    @Column(name = "REMARK", length = 90)
    public String getRemark() {
        return this.remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Version
    @Column(name = "VERSION", precision = 22, scale = 0)
    public Long getVersion() {
        return this.version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

    @Column(name = "TRAN_FINISH_TIME")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getTranFinishTime() {
		return this.tranFinishTime;
	}

	public void setTranFinishTime(Date tranFinishTime) {
		this.tranFinishTime = tranFinishTime;
	}
}
